@import "../core/exports";
@import "../core/mobiscroll";

@mixin mbsc-mobiscroll-progress($theme, $params) {
  @include exports("progress.#{$theme}.colors") {

    $background: map-get($params, 'background');
    $accent: map-get($params, 'accent');
    $text: map-get($params, 'text');
    // derived colors
    $input-icon: lighten($text, 20%);

    $track: '';
    // Light background
    @if (lightness($background) > 50%) {
      $track: darken($background, 10%);
    }
    // Dark background
    @else {
      $track: lighten($background, 8%);
    }

    .mbsc-#{$theme} {
      &.mbsc-progress .mbsc-input-ic {
        color: $input-icon;
      }

      .mbsc-progress-track {
        background: $track;
      }

      .mbsc-progress-bar {
        background: $accent;
      }
    }
  }
}
